// pages/community/community.js
import { selectNeighborhoodSharing } from '../../apis/neighborhoodSharing';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    /*当前标签栏*/ 
    activenum:'0',
    show: false,
    /*邻里分享数组*/
    share:[
    ],
    /*活动招募数组*/
    actives:[
      {image:'https://img2.baidu.com/it/u=1346456739,3494556932&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=200',title:'你好！2021',address:'',time:'2020年12月31日~2021年01月20日',num:'0',bottomimage:[
      ]},
      {image:'https://img2.baidu.com/it/u=1346456739,3494556932&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=200',title:'你好！2021',address:'',time:'2020年12月31日~2021年01月20日',num:'10',bottomimage:[
        {image:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=50'},
        {image:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=50'},
        {image:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=50'}
      ]},
      {image:'https://img2.baidu.com/it/u=1346456739,3494556932&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=200',title:'你好！2021',address:'',time:'2020年12月31日~2021年01月20日',num:'10',bottomimage:[
        {image:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=50'},
        {image:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=50'},
        {image:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=50'}
      ]},
    ],
    /*跳蚤市场*/
    fleamarket:[
      {url:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',name:'杨业主',address:'成都中海翠屏湾',money:'19000.00',content:'出售单反相机！！！',image:[
        {image:'https://img1.baidu.com/it/u=584161819,4136673136&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500'},
        {image:'https://img0.baidu.com/it/u=4241472555,3650325812&fm=253&fmt=auto&app=138&f=JPEG?w=904&h=500'},
        {image:'https://img1.baidu.com/it/u=1941052552,52605357&fm=253&fmt=auto&app=120&f=JPEG?w=640&h=427'},
        {image:'https://img1.baidu.com/it/u=1941052552,52605357&fm=253&fmt=auto&app=120&f=JPEG?w=640&h=427'},
      ]},
      {url:'https://img1.baidu.com/it/u=1659441821,1293635445&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',name:'王业主',address:'成都中海翠屏湾',money:'20000.00',content:'出售电冰箱！！!',image:[]},
    ]
  },
  
  //跳转页面
  toNeighborhoodFen(){
    wx.navigateTo({
      url: '/secondary_page/neighborhoodFen/neighborhoodFen'
    })
  },
  // 去跳蚤市场
  toSecondhandMarket(){
    wx.navigateTo({
      url: '/secondary_page/secondhandMarket/secondhandMarket'
    })
  },
  close(){
    this.setData({ show: false });
  },
  new(){
    this.setData({ show: true });
    console.log(1)
  },
  onClose() {
    this.setData({ show: false });
  },

  onSelect(event) {
    console.log(event.detail);
  },
  onClick(event) {
    this.setData({
      //获取当前标签栏
      activenum:`${event.detail.name}`
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
      
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    var that = this;
        //服务器地址
        //接口地址
        selectNeighborhoodSharing(1).then(function(res){
            //判断成功
            console.log(res.obj);
            that.setData({
              share:res.obj
            })
        });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})